//
//  MKTChatItemTVCellBase.m
//  MKUITestApp
//
//  Created by 苏尚进 on 2021/7/9.
//  Copyright © 2021 moon. All rights reserved.
//

#import "MKTChatItemTVCellBase.h"

@implementation MKTChatItemTVCellBase

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.contentView.backgroundColor = [UIColor clearColor];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}
- (MKTChatItemBase *)item{
    return self.cellModel.modelValue;
}
@end

#import "MKTChatItemUnknowTVCell.h"
NSString *const kMKTChatItemRegisterCategory=@"kMKTChatItemRegisterCategory";
@implementation MKTChatItemBase(MKTRegisterManager)
- (Class)tableViewCellClass{
    NSString *key = NSStringFromClass(self.class);
    Class cellClass = [[MKTRegisterManager sharedInstance] valueRegistedForKey:key category:kMKTChatItemRegisterCategory];
    if(!cellClass){
        cellClass = [MKTChatItemUnknowTVCell class];
    }
    return cellClass;
}
@end

@implementation MKTChatItemTVCellBase(MKTRegisterManager)
+ (void)registerTableViewCellFor:(Class)aClass{
    MKTRegisterOption *option = [[MKTRegisterOption alloc] initWithKey:NSStringFromClass(aClass) value:self.class priority:kMKTRegisterPriotiryDefault];
    [[MKTRegisterManager sharedInstance] registerOption:option forCategory:kMKTChatItemRegisterCategory];
}
@end
